| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

TreeReader.h
1 // TreeReader.h
3 //
5
6 namespace nkExport
7 {
11 class TreeReaderEntry
12 {
13 public :
14
15 // Constructor, destructor
21 TreeReaderEntry (nkMemory::StringView path) noexcept ;
25 TreeReaderEntry (const TreeReaderEntry&) noexcept ;
29 TreeReaderEntry (TreeReaderEntry&&) noexcept ;
33 virtual ~TreeReaderEntry () ;
34
35 // Getters
39 nkMemory::StringView getPath () const ;
40
41 // Operators
45 TreeReaderEntry& operator= (const TreeReaderEntry&) noexcept ;
49 TreeReaderEntry& operator= (TreeReaderEntry&&) noexcept ;
50
51 // Implementation
55 virtual void fill (nkExport::Node*) = 0 ;
56 } ;
57
61 template <typename T>
62 class TreeReaderTemplateEntry final : public TreeReaderEntry
63 {
64 public :
65
66 // Constructor, destructor
73 TreeReaderTemplateEntry (T& target, nkMemory::StringView path) ;
77 virtual ~TreeReaderTemplateEntry () = default ;
78
79 // Implementation
80 virtual void fill (nkExport::Node*) override ;
81 } ;
82
86 template <template<typename...> typename C, typename T>
87 class TreeReaderCompositeEntry : public TreeReaderEntry
88 {
89 public :
90
91 // Constructor, destructor
99 TreeReaderCompositeEntry (C<T>& target, std::function<T (nkExport::Node*)> entryFiller, nkMemory::StringView path) ;
103 virtual ~TreeReaderCompositeEntry () = default ;
104
105 // Implementation
106 virtual inline void fill (nkExport::Node* node) override ;
107 } ;
108
136 class TreeReader final
137 {
138 public :
139
140 // Constructor, destructor
144 TreeReader () noexcept ;
148 TreeReader (const TreeReader&) = delete ;
154 TreeReader (TreeReader&& other) noexcept ;
155
156 // Controls
165 void addBool (bool& target, nkMemory::StringView path) ;
174 void addInt (int& target, nkMemory::StringView path) ;
183 void addUint (unsigned int& target, nkMemory::StringView path) ;
192 void addFloat (float& target, nkMemory::StringView path) ;
201 void addString (nkMemory::String& target, nkMemory::StringView path) ;
202
214 template <typename T>
215 void addVector (nkMemory::BufferCast<T>& target, std::function<T (nkExport::Node*)> entryFiller, nkMemory::StringView path) ;
216
228 template <typename T>
229 void addVector (std::vector<T>& target, std::function<T (nkExport::Node*)> entryFiller, nkMemory::StringView path) ;
230
239 template <typename T = std::string>
240 void addString (std::string& target, nkMemory::StringView path) ;
241
242 // Filling
248 void fill (nkExport::Node* tree) ;
249
250 // Operators
254 TreeReader& operator= (const TreeReader&) = delete ;
258 TreeReader& operator= (TreeReader&&) noexcept ;
259 } ;
260 }
nkExport::TreeReaderTemplateEntry::fill
virtual void fill(nkExport::Node *) override
nkExport::TreeReaderTemplateEntry
Templated utility version of an entry within the tree reader.
Definition: TreeReader.h:63
nkExport::TreeReaderEntry
An internal entry stored within the TreeReader.
Definition: TreeReader.h:12
nkExport::TreeReaderCompositeEntry::TreeReaderCompositeEntry
TreeReaderCompositeEntry(C< T > &target, std::function< T(nkExport::Node *)> entryFiller, nkMemory::StringView path)
nkExport::TreeReaderEntry::TreeReaderEntry
TreeReaderEntry(TreeReaderEntry &&) noexcept
nkExport::TreeReaderEntry::TreeReaderEntry
TreeReaderEntry(nkMemory::StringView path) noexcept
nkExport::TreeReaderCompositeEntry::~TreeReaderCompositeEntry
virtual ~TreeReaderCompositeEntry()=default
nkExport
Encompasses all API of component NilkinsExport.
Definition: Base64Encoder.h:7
nkExport::TreeReaderCompositeEntry
A templated version of a composite entry, aimed at filling containers.
Definition: TreeReader.h:88
nkExport::TreeReaderCompositeEntry::fill
virtual void fill(nkExport::Node *node) override
nkExport::TreeReaderEntry::fill
virtual void fill(nkExport::Node *)=0
nkExport::TreeReaderEntry::getPath
nkMemory::StringView getPath() const
nkExport::TreeReaderEntry::TreeReaderEntry
TreeReaderEntry(const TreeReaderEntry &) noexcept
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkExport::TreeReader
Utility class providing an easier way to parse trees.
Definition: TreeReader.h:137
nkExport::TreeReaderTemplateEntry::TreeReaderTemplateEntry
TreeReaderTemplateEntry(T &target, nkMemory::StringView path)
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkExport::TreeReaderTemplateEntry::~TreeReaderTemplateEntry
virtual ~TreeReaderTemplateEntry()=default
nkExport::TreeReader::TreeReader
TreeReader() noexcept
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7